//
//  YKClientExchangeV2ItemCell.m
//  YunKang
//
//  Created by leoking870 on 2018/6/13.
//  Copyright © 2018年 leoking870. All rights reserved.
//

#import "YKClientExchangeV2ItemCell.h"

@interface YKClientExchangeV2ItemCell ()
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *numberLabel;
@property (weak, nonatomic) IBOutlet UILabel *typeLabel;
@property (weak, nonatomic) IBOutlet UILabel *descLabel;
@property (weak, nonatomic) IBOutlet UILabel *dateLabel;
@property (weak, nonatomic) IBOutlet UILabel *statusLabel;
@property (weak, nonatomic) IBOutlet UILabel *scoreLabel;

@end

@implementation YKClientExchangeV2ItemCell
@dynamic tableViewItem;

- (void)cellWillAppear {
    [super cellWillAppear];
    
    self.nameLabel.text = self.tableViewItem.model.C_NAME;
    self.numberLabel.text = self.tableViewItem.model.APPLY_CODE;
    self.typeLabel.text = self.tableViewItem.model.ST_NAME;
    self.descLabel.text = self.tableViewItem.model.EXCHANGE_CONTENT;
    self.dateLabel.text = [[self.tableViewItem.model.APPLY_DATE componentsSeparatedByString:@" "]firstObject];
    if ([self.tableViewItem.model.APPLY_STATUS isEqualToString:@"0"]) {
        self.statusLabel.text = @"未处理";
    }
    
    else if ([self.tableViewItem.model.APPLY_STATUS isEqualToString:@"1"]) {
        self.statusLabel.text = @"审批中";
    }
    else if ([self.tableViewItem.model.APPLY_STATUS isEqualToString:@"2"]) {
        self.statusLabel.text = @"已通过";
    }
    else if ([self.tableViewItem.model.APPLY_STATUS isEqualToString:@"3"]) {
        self.statusLabel.text = @"被驳回";
    }else if ([self.tableViewItem.model.APPLY_STATUS isEqualToString:@"4"]) {
        self.statusLabel.text = @"被退回";
    }
    self.scoreLabel.text = self.tableViewItem.model.EXCHANGE_POINT;
    
    [self.contentView.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        if ([obj isKindOfClass:[UILabel class]]) {
            UILabel *label = (UILabel *)obj;
            label.textColor = [UIColor blackColor];
        }
    }];
}

@end
